#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "methodget.h"

int main(void)
{
    char* str;
    printf("Content-Type: text/plain;charset=utf-8\n\n");
    str = getenv("QUERY_STRING");
    char* id = "name";
    char name[255];
    if (*str == '\0')
    {
        printf("There are not identifiers!");
    }
    else
    {
		int errCode = getName(id, str, name);
        if (errCode == EMPTY_NAME_ERR)
        {
            printf("Name is empty!");    
        }
        else if (errCode == NOT_FOUND_ID_ERR)
        {
            printf("Identifier '%s' was not found!", id);
        }
        else if (errCode == OK)
        {
            printf("Hello, Dear '%s'", name);
        }
    }
}